import axios from 'axios';
import { loginreq, req } from './axiosFun';
import {getCookie} from "../utils/util";

axios.interceptors.request.use(
  config=>{
config.headers['token']=getCookie("token")
    return config;
  }
)

// 登录接口
export const login = (params) => { return loginreq("post", "http://localhost:8099/serviceedu/login/DoctorLogin", params) };
// 根据token获取用户信息
export const getInfo = () => { return loginreq("get", "http://localhost:8099/serviceedu/login/getDoctorInfo") };

/**
 * 用户管理
 **/
// 用户管理-获取用户列表
export const userList = (params) => { return req("post", "http://localhost:8099/serviceedu/customer/findAll", params) };
// 用户管理-删除用户
export const userDelete = (customerId) => { return axios.delete("http://localhost:8099/serviceedu/customer/del/" + customerId ) };


/**
 * 种类管理
 **/
// 种类管理-获取种类列表
export const categoryList = (params) => { return req("post", "http://localhost:8099/serviceedu/category/findAll", params) };
// 种类管理-保存（添加编辑）
export const categorySave = (params) => { return req("post", "http://localhost:8099/serviceedu/category/addCategory/", params) };
export const categoryEdit = (params) => { return req("put", "http://localhost:8099/serviceedu/category/update", params) };
// 种类管理-删除种类
export const categoryDelete = (id) => { return axios.delete("http://localhost:8099/serviceedu/category/del/" +id) };
// 种类管理-查看详情种类
export const categoryFindList = (id) => { return req("get","http://localhost:8099/serviceedu/category/findById/" +id) };
/**
 * 医院管理
 **/
// 医院管理-获取医院列表
export const hospitalList = (params) => { return req("post", "http://localhost:8099/serviceedu/hospital/findAll", params) };
// 医院管理-保存（添加编辑）
export const hospitalSave = (params) => { return req("post", "http://localhost:8099/serviceedu/hospital/addHospital", params) };
export const hospitalEdit = (params) => { return req("put", "http://localhost:8099/serviceedu/hospital/update", params) };
// 医院管理-医院管理
export const hospitalDelete = (hospitalId) => { return axios.delete("http://localhost:8099/serviceedu/hospital/del/" + hospitalId ) };

/**
 * 医生管理
 **/
// 医生管理-获取医生列表
export const doctorList = (params) => { return req("post", "http://localhost:8099/serviceedu/doctor/findAll/", params) };
// 医生管理-保存（添加）
export const doctorSave = (params) => { return req("post", "http://localhost:8099/serviceedu/doctor/addDoctor", params) };
// 医生管理-（修改）
export const doctorEdit = (params) => { return req("put", "http://localhost:8099/serviceedu/doctor/update", params) };
// 医生管理-删除
export const doctorDelete = (doctorId) => { return axios.delete("http://localhost:8099/serviceedu/doctor/del/" + doctorId ) };
// 医生管理-（修改）
export const hospList = () => { return req("get", "http://localhost:8099/serviceedu/doctor/listHosp") };
/**
 * 权限管理
 **/
// 权限管理-获取权限列表
export const permissionList = (params) => { return req("post", "/api/Permission/list", params) };
// 权限管理-保存权限
export const ermissionSave = (params) => { return req("post", "/api/Permission/save", params) };
// 权限管理-删除权限
export const ermissionDelete = (params) => { return axios.delete("/api/Permission/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 权限管理-获取权限
export const roleDropDown = () => { return axios.get("/api/Role/dropDown/all?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 权限管理-配置权限
export const RolePermission = (params) => { return req("post", "/api/RolePermission/save", params) };

/**
 * 视频管理
 **/
// 获取视频列表
export const deptList = (params) => { return req("get", "http://localhost:8099/serviceedu/video/findAll/", params) };
// 视频管理（添加）
export const deptSave = (params) => { return req("post", "http://localhost:8099/serviceedu/video/addVod", params) };
// 视频管理（修改）
export const deptEdit = (params) => { return req("put", "http://localhost:8099/serviceedu/video/update", params) };
// 视频管理-删除
export const deptDelete = (videoId) => { return axios.delete("http://localhost:8099/vod/delVod/" + videoId ) };
export const deptDelete1 = (vodId) => { return axios.delete("http://localhost:8099/serviceedu/video/del/" + vodId ) };

